<?php
include('../../includes/classes/core.php');
 
$c_data = date('Y-m-d H:i:s');
$letter_id = $_REQUEST['id'];

$res = mysql_fetch_assoc(mysql_query("SELECT	`d_letter`.`id` as `id`,
												`d_letter`.`request_date` as `date`,
												CONCAT(`client`.`name`,'(',`client_objects`.`name`, ')') AS `client`,
												`d_letter`.`comment` as `comment`
								FROM			`d_letter`
								LEFT JOIN		`client_objects` ON `d_letter`.`client_object_id` = `client_objects`.`id`
								LEFT JOIN		`client` ON `client`.`id` = `client_objects`.`client_id`
								WHERE			`d_letter`.`id` = '$letter_id' && d_letter.actived=1"));

function print1(){
	GLOBAL $letter_id;
	$rsql = mysql_query("
                	    SELECT COUNT(warehouse_detail.id),
                	                 production.`name`,
                	                 `warehouse_detail`.`comment`,
                					 `warehouse_detail`.`type`
                	    FROM   warehouse_detail
                	    LEFT JOIN production ON production.id = prod_id
                	    LEFT JOIN warehouse ON warehouse.id=warehouse_detail.warehouse_id
                	    WHERE warehouse.d_letter_id='$letter_id' AND warehouse_detail.actived=1 AND warehouse_detail.type=1
                	    GROUP BY prod_id
                	    ");

	for($j=0;$j<16;$j++){
		while ( $aRow = mysql_fetch_array( $rsql ) ){
			$data .= '<tr>';
			for ( $i = 0 ; $i < 3; $i++ ){
				$data .= '<td>' . $aRow[$i] . '</td>';
			}
			if($aRow[3] == 2){
				$data .= '<td><img src="../../media/images/0.gif"></td>';
			}else{
				$data .= '<td>&nbsp;</td>';
			}

			$data .= '</tr>';
			$j++;
		}
		$data .='
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
				</tr>';
	}
	return $data;
}

?>


<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>დ ბარათი</title>
	<style type="text/css">

		body{
			text-align:center;
		}

		.job-blank{
			width: 480px;
		}
		.job-blanksub{
			width: 238px;
		}

		.job-blank td{
			text-align: center;
			font-weight: bold;
			font-family: Sylfaen, Arial, sans-serif;
			font-size: 10.0pt;
		}

		.job-blank .rotate{
			font-size: 8pt;
			writing-mode: tb-rl;
			-webkit-transform: rotate(270deg);
			-moz-transform: rotate(270deg);
			-o-transform: rotate(270deg);
			white-space: nowrap;
			display: block;
			width: 8px;
		}

		.style1{
			margin-top: 40px;
			margin-left: 4px;
		}

		.style2{
			margin-top: 75px;
			margin-left: 4px;
		}


		.sub{
			width: 25px;
		}
	</style>
</head>

<body >
<div align=center>
	<table border="0" class="job-blank" cellpadding="0" cellspacing="0">
		<tr>
			<td colspan="4" style="padding: 2px; vertical-align:top;border-bottom:6px double;">
					<div style="float: left;">
					<img src="logo.jpg" width="58" height="58" style="float: left;">
					<table border="0" cellpadding="0" cellspacing="0" style="padding-left: 10px;">
							<tr>
								<td style="padding-top: 10px; font-size: 70%;">service@</td>
								<th rowspan="2" style="font-size:180%; padding-bottom: 10px;">gsunity.ge</th>
							</tr>
							<tr>
								<td style="padding-bottom: 10px; font-size: 70%;">w&nbsp;w&nbsp;w.</td>
							</tr>
					</table>
					</div>
					<div style="float: right;">
					<table border="0" cellpadding="0" cellspacing="0" >
						<tr>
							<th style="font-size: 75%;">შპს "ჯი ეს უნიტი"</th>
						</tr>
						<tr>
							<td style="font-size: 65%;">თბილისი, ჯიქიას ქ. № 10</td>
						</tr>
						<tr>
							<td style="font-size: 65%;">Tel: 8(22) 555 118; 8(22) 300 065</td>
						</tr>
						<tr>
							<td style=" font-size: 65%;">Mob: 8(95) 74 95 74; 8(95) 40 40 13</td>
						</tr>
					</table>
					</div>
			</td>
		</tr>
		<tr>
			<!-- <td rowspan="4" valign="top" style="padding: 2px;"><img src="logo.jpg" width="68" height="68" style="float: left;"></td> -->
			<td colspan="3" style="font-size: 11pt; padding-top: 15px; text-align: right; width: 60%;font-size: 9pt;">მიღება ჩაბარების აქტი №</td>
			<td colspan="1" style="font-weight: normal; padding-top: 5px; text-align: left;"><span style="border-bottom: 1px solid #000; padding: 0 30px; margin-left: 10px;">დ – &nbsp;<?php echo $res['id']; ?></span></td>
		</tr>
		<tr>
			<td colspan="4"><div style="font-weight: normal; display: inline; padding-left: 210px; font-size: 9pt;">თარიღი :&nbsp;</div> <div style="font-size: 10pt; float: right; display: inline;"><span style="border-bottom: 1px solid #000; padding: 0 30px; margin-left: 0px;"><?php echo $res['date']; ?></span></div></td>
		</tr>
		<tr>
			<td colspan="4" style="font-weight: normal; text-align: left; font-size: 9pt;">მომსახურების ობიექტი:<div style="display: inline;"><span style="border-bottom: 1px solid #000; margin-left: 5px;">&nbsp;"<?php echo $res['client']; ?>"</span></div></td>
		</tr>
	</table>
	<div style="padding-top: 5px;"></div>
	<table border="1" class="job-blank" cellpadding="0" cellspacing="0">
		<tr style="background-color: black;">
			<td style="width: 10%;font-size: 9pt; color: white;"><span>რაოდენობა</span></td>
			<td style="width: 25%;font-size: 9pt; color: white;"><span>მოდელი</span></td>

			<td style="width: 45%;font-size: 9pt; color: white;"><span>შენიშვნა</span></td>
			<td style="width: 20%;font-size: 9pt; color: white;"><span>გარ.</span></td>
		</tr>
		<?php echo print1(1)?>
	</table>
	<div style="padding-top: 2px;"></div>
	<table border="1" class="job-blank" cellpadding="0" cellspacing="0">
		<tr style="background-color: #D9D9D9; text-align: left;">
			<td style="text-align: left;">შენიშვნა</td>
		</tr>
		<tr>
			<td style="text-align: center;">
				<?php  echo $res['comment']; ?>&nbsp;
			</td>
		</tr>
	</table>
<div  style="font-size: 74%; text-align: center; ">
<pre>შპს "ჯი ეს იუნიტი"–ს წარმომადგენელმა ("მიმწოდებელი") გადასცა, ხოლო "მომსახურების
ობიექტის"წარმომადგენელმა ("მიმღებმა") ჩაიბარა ცხრილში აღნიშნული საქონელი და
 მომსახურება,რასაც ვადასტურებთ ხელმოწერით</pre>
</div>
	<div style="width: 480px; text-align: left;">
		<p style="font-weight: normal; font-size: 9pt;">მიმწოდებელი :&nbsp;<span style="border-bottom: 1px solid #000; padding: 0 120px; margin-left: 0px;"></span><span style="border-bottom: 1px solid #000; padding: 0 60px; margin-left: 30px;"></span></p>
	</div>
	<div style="width: 480px; text-align: left; padding-left: 10px;">
		<p style="font-weight: normal; font-size: 9pt; margin-left: 30px;">მიმღები :&nbsp;<span style="border-bottom: 1px solid #000; padding: 0 120px; margin-left: 0px;"></span><span style="border-bottom: 1px solid #000; padding: 0 60px; margin-left: 30px;"></span></p>
	</div>
	<div style="position: relative; top: -40px; left: 20px; width: 330px;font-weight: normal; font-size: 6pt;">სახელი&nbsp;&nbsp;&nbsp;&nbsp; გვარი</div>
	<div style="position: relative; top: -23px; left: 20px; width: 330px;font-weight: normal; font-size: 6pt;">სახელი&nbsp;&nbsp;&nbsp;&nbsp; გვარი</div>
	<div style="position: relative; top: -34px; left: 190px; width: 330px;font-weight: normal; font-size: 6pt;">ხელმოწერა</div>
	<div style="position: relative; top: -73px; left: 190px; width: 330px;font-weight: normal; font-size: 6pt;">ხელმოწერა</div>
</div>
</body>

</html>